//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "VegaBumpCluster.h"
using namespace Cephei::QL::Models::Marketmodels::Pathwisegreeks;
#include <gen/QL/Models/Marketmodels/MarketModel.h>
using namespace Cephei::QL::Models::Marketmodels;
#undef HANDLE
#undef ABSTRACT
#define STRUCT
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (UInt64 factorBegin, UInt64 factorEnd, UInt64 rateBegin, UInt64 rateEnd, UInt64 stepBegin, UInt64 stepEnd) 
{
	_pSpinlock = new boost::detail::spinlock ();
    try
    {
#ifdef HANDLE
        _phVegaBumpCluster = NULL;
#endif
        QuantLib::Size _factorBegin = (QuantLib::Size)ValueHelper::Convert (factorBegin); //d
        QuantLib::Size _factorEnd = (QuantLib::Size)ValueHelper::Convert (factorEnd); //d
        QuantLib::Size _rateBegin = (QuantLib::Size)ValueHelper::Convert (rateBegin); //d
        QuantLib::Size _rateEnd = (QuantLib::Size)ValueHelper::Convert (rateEnd); //d
        QuantLib::Size _stepBegin = (QuantLib::Size)ValueHelper::Convert (stepBegin); //d
        QuantLib::Size _stepEnd = (QuantLib::Size)ValueHelper::Convert (stepEnd); //d
        _ppVegaBumpCluster = new boost::shared_ptr<QuantLib::VegaBumpCluster> (new QuantLib::VegaBumpCluster ( _factorBegin,  _factorEnd,  _rateBegin,  _rateEnd,  _stepBegin,  _stepEnd ));
        
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (boost::shared_ptr<QuantLib::VegaBumpCluster>& childNative, Object^ owner) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phVegaBumpCluster = NULL;
#endif
	_ppVegaBumpCluster = &childNative;
    
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (QuantLib::VegaBumpCluster& childNative, Object^ owner) 
{
#ifdef HANDLE
	_phVegaBumpCluster = NULL;
#endif
	_ppVegaBumpCluster = new boost::shared_ptr<QuantLib::VegaBumpCluster> (&childNative);
    
    _VegaBumpClusterOwner = owner;
    
}

Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (CVegaBumpCluster^ copy) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phVegaBumpCluster = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppVegaBumpCluster = new boost::shared_ptr<QuantLib::VegaBumpCluster> (copy->GetShared());
        
    }
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (PLATFORM::Type^ t) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phVegaBumpCluster = NULL;
#endif
	if (!t->IsSubclassOf(CVegaBumpCluster::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (QuantLib::Handle<QuantLib::VegaBumpCluster>& childNative, Object^ owner)  
{
	_pSpinlock = new boost::detail::spinlock ();
	_phVegaBumpCluster = &childNative;
	_ppVegaBumpCluster = &static_cast<boost::shared_ptr<QuantLib::VegaBumpCluster>>(childNative.currentLink());
    
    _VegaBumpClusterOwner = owner;
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (QuantLib::Handle<QuantLib::VegaBumpCluster> childNative)  
{
	_pSpinlock = new boost::detail::spinlock ();
	_phVegaBumpCluster = &childNative;
	_ppVegaBumpCluster = &static_cast<boost::shared_ptr<QuantLib::VegaBumpCluster>>(childNative.currentLink());
    
}
#endif
#ifdef STRUCT
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::CVegaBumpCluster (QuantLib::VegaBumpCluster childNative)  
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phVegaBumpCluster = NULL;
#endif
	_ppVegaBumpCluster = new boost::shared_ptr<QuantLib::VegaBumpCluster> (new QuantLib::VegaBumpCluster (childNative));
    
}
#endif

Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::~CVegaBumpCluster ()
{
	if (_pSpinlock != NULL)
    {
        delete _pSpinlock;
        _pSpinlock = NULL;
    }
    if (_ppVegaBumpCluster != NULL)
    {
	    delete _ppVegaBumpCluster;
        _ppVegaBumpCluster = NULL;
    }
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::!CVegaBumpCluster ()
{
	if (_pSpinlock != NULL)
    {
        delete _pSpinlock;
    }
    if (_ppVegaBumpCluster != NULL)
    {
	    delete _ppVegaBumpCluster;
    }
}
QuantLib::VegaBumpCluster& Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::GetReference ()
{
    if (_ppVegaBumpCluster == NULL) throw REFNEW NativeNullException ();
	return **_ppVegaBumpCluster;
}
boost::shared_ptr<QuantLib::VegaBumpCluster>& Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::GetShared ()
{
    if (_ppVegaBumpCluster == NULL) throw REFNEW NativeNullException ();
	return *_ppVegaBumpCluster;
}
QuantLib::VegaBumpCluster* Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::GetPointer ()
{
    if (_ppVegaBumpCluster == NULL) throw REFNEW NativeNullException ();
	return &**_ppVegaBumpCluster;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::VegaBumpCluster>& Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::GetHandle ()
{
	if (_phVegaBumpCluster == NULL)
	{
		_phVegaBumpCluster = new Handle<QuantLib::VegaBumpCluster> (*_ppVegaBumpCluster);
	}
	return *_phVegaBumpCluster;
}
#endif
bool Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::HasNative () 
{
	return (_ppVegaBumpCluster != NULL);
}

Boolean Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::DoesIntersect (Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^ comparee)
{
    CVegaBumpCluster^ _Ccomparee;
    try
    {
        _Ccomparee = safe_cast<CVegaBumpCluster^> (comparee);
        _Ccomparee->Lock();
        QuantLib::VegaBumpCluster& _comparee = static_cast<QuantLib::VegaBumpCluster&> (_Ccomparee->GetReference ()); 
    	bool _rv = (bool)(*_ppVegaBumpCluster)->doesIntersect ( _comparee );   
        Boolean _nrv = (Boolean)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (_Ccomparee != nullptr) _Ccomparee->Unlock();
    }
}
UInt64 Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::FactorBegin::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppVegaBumpCluster)->factorBegin ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
UInt64 Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::FactorEnd::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppVegaBumpCluster)->factorEnd ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Boolean Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::IsCompatible (Cephei::QL::Models::Marketmodels::IMarketModel^ volStructure)
{
    CMarketModel^ _CvolStructure;
    try
    {
        _CvolStructure = safe_cast<CMarketModel^> (volStructure);
        _CvolStructure->Lock();
        boost::shared_ptr<QuantLib::MarketModel>& _volStructure = static_cast<boost::shared_ptr<QuantLib::MarketModel>&> (_CvolStructure->GetShared ()); 
    	bool _rv = (bool)(*_ppVegaBumpCluster)->isCompatible ( _volStructure );   
        Boolean _nrv = (Boolean)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (_CvolStructure != nullptr) _CvolStructure->Unlock();
    }
}
UInt64 Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::RateBegin::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppVegaBumpCluster)->rateBegin ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
UInt64 Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::RateEnd::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppVegaBumpCluster)->rateEnd ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
UInt64 Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::StepBegin::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppVegaBumpCluster)->stepBegin ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
UInt64 Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster::StepEnd::get ()
{
    try
    {
    	QuantLib::Size _rv = (QuantLib::Size)(*_ppVegaBumpCluster)->stepEnd ( );   
        UInt64 _nrv = _rv; //c1
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CVegaBumpClusterVector ()
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::~CVegaBumpClusterVector ()
{
#ifdef STRUCT
	if (_pVValue != NULL) delete _pVValue;
	_pVValue = NULL;
#endif   
	if (_pVBoost != NULL) delete _pVBoost;
	_pVBoost = NULL;
#ifdef HANDLE
	if (_pVHand != NULL) delete _pVHand;
	_pVHand = NULL;
#endif
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::!CVegaBumpClusterVector ()
{
#ifdef STRUCT
	if (_pVValue != NULL) delete _pVValue;
#endif   
	if (_pVBoost != NULL) delete _pVBoost;
#ifdef HANDLE
	if (_pVHand != NULL) delete _pVHand;
#endif
}
#ifdef STRUCT
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CVegaBumpClusterVector (std::vector<QuantLib::VegaBumpCluster>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	_pVValue = &vec;
	_owner = owner;
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CVegaBumpClusterVector (std::vector<QuantLib::VegaBumpCluster> vec)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	_pVValue = new std::vector<QuantLib::VegaBumpCluster> (vec);
}
#endif
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CVegaBumpClusterVector (std::vector<boost::shared_ptr<QuantLib::VegaBumpCluster>>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	 _pVBoost = &vec;
	_owner = owner;
}
#ifdef HANDLE
Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CVegaBumpClusterVector (std::vector<QuantLib::Handle<QuantLib::VegaBumpCluster>>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	 _pVHand = &vec;
	_owner = owner;
}
#endif

int Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::Count::get ()
{
#ifdef STRUCT
	if (_pVValue != NULL) 
	{
		return _pVValue->size();
	}
#endif    
	if (_pVBoost != NULL)
	{
		return _pVBoost->size ();
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
		return _pVHand->size ();
	}
#endif
	return 0;		// should never happen
}
Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::default::get (int index) 
{
#ifdef STRUCT
	if (_pVValue != NULL) 
	{
    	if ((size_t)index >= _pVValue->size()) throw REFNEW RangeException ();
		QuantLib::VegaBumpCluster& native = (*_pVValue)[index];
		return REFNEW CVegaBumpCluster (native, this);
	}
#endif    
	if (_pVBoost != NULL)
	{
    	if ((size_t)index >= _pVBoost->size()) throw REFNEW RangeException ();
		QuantLib::VegaBumpCluster& native = *(*_pVBoost)[index];
		return REFNEW CVegaBumpCluster (native, this);
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
    	if ((size_t)index >= _pVHand->size()) throw REFNEW RangeException ();
		QuantLib::VegaBumpCluster& native = *((*_pVHand)[index].currentLink ());
		return REFNEW CVegaBumpCluster (native, this);
	}
#endif
	return nullptr;		// can never be the case
}
void Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::default::set (int index, Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^ value) 
{
#ifdef STRUCT
	if (_pVValue != NULL)
	{
		if (_pVValue->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVValue->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVValue->push_back (dynamic_cast<CVegaBumpCluster^>(value)->GetReference ());
		}
        else
        {
            QuantLib::VegaBumpCluster& c = (*_pVValue)[index];
            c = dynamic_cast<CVegaBumpCluster^>(value)->GetReference ();
        }
	}
#endif   
	if (_pVBoost != NULL)
	{
		if (_pVBoost->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVBoost->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVBoost->push_back (dynamic_cast<CVegaBumpCluster^>(value)->GetShared ());
		}
		boost::shared_ptr<QuantLib::VegaBumpCluster>& c = (*_pVBoost)[index];
		c = dynamic_cast<CVegaBumpCluster^>(value)->GetShared ();
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
		if (_pVHand->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVHand->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVHand->push_back (QuantLib::Handle<QuantLib::VegaBumpCluster> ());
		}
		QuantLib::Handle<QuantLib::VegaBumpCluster>& c = (*_pVHand)[index];
		boost::shared_ptr<QuantLib::VegaBumpCluster>& b = static_cast<boost::shared_ptr<QuantLib::VegaBumpCluster>>(c.currentLink());
		b = dynamic_cast<CVegaBumpCluster^>(value)->GetShared ();
	}
#endif
}
Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CItem::get (int index) 
{
	return CellFactory::Instance->Create<IVegaBumpCluster^> (dynamic_cast<IVegaBumpCluster^>(default[index]));
}

void Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::CItem::set (int index, Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^ value) 
{
	default[index] = safe_cast<IVegaBumpCluster^>(value->Value);
}
#ifdef STRUCT
std::vector<QuantLib::VegaBumpCluster>& Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::GetReference ()
{
	 return *_pVValue;
}
#endif

std::vector<boost::shared_ptr<QuantLib::VegaBumpCluster>>& Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::GetShared ()
{
	return *_pVBoost;
}

#ifdef HANDLE
std::vector<QuantLib::Handle<QuantLib::VegaBumpCluster>>& Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::GetHandle ()
{
	return *_pVHand;
}
#endif
bool Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpClusterVector::PrepareFeature (NativeFeature feature)
{
	switch (feature)
	{
#ifdef STRUCT
		case NativeFeature::Value :
			if (_pVValue == NULL)
			{
				_pVValue = new std::vector<QuantLib::VegaBumpCluster> ();
				return true;
			}
			break;
#endif
        case NativeFeature::shared_ptr :
			if (_pVBoost == NULL)
			{
				_pVBoost = new std::vector<boost::shared_ptr<QuantLib::VegaBumpCluster>> ();
				return true;
			}
			break;
#ifdef HANDLE
        case NativeFeature::Handle :
            if (_pVHand == NULL)
            {
                _pVHand = new std::vector<QuantLib::Handle<QuantLib::VegaBumpCluster>> ();
                return true;
            }
            break;
#endif
	}
	return false;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster_Factory::Create (UInt64 factorBegin, UInt64 factorEnd, UInt64 rateBegin, UInt64 rateEnd, UInt64 stepBegin, UInt64 stepEnd)
{
    return REFNEW CVegaBumpCluster ( factorBegin,  factorEnd,  rateBegin,  rateEnd,  stepBegin,  stepEnd);
}
/* <summary>Create a single dimension array of VegaBumpCluster that can be passed into other function </summary> */
IVector<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster_Factory::CreateVector ()
 {
	 return REFNEW CoVector<IVegaBumpCluster^> (REFNEW CVegaBumpClusterVector ());
 }
IVector<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster_Factory::CreateVector (PLATFORM::Collections::Generic::IEnumerable<IVegaBumpCluster^>^ source)
 {
	 return REFNEW CoVector<IVegaBumpCluster^> (source, REFNEW CVegaBumpClusterVector ());
 }
/* <summary>Create a single dimension array of VegaBumpCluster with change events</summary> */
Cephei::Core::Generic::ICoCell<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^>^>^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster_Factory::CreateCellVector ()
 {
	 return CellFactory::Instance->Create<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^>^> (REFNEW CoCellVector<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^> (REFNEW CVegaBumpClusterVector ()));
 }
Cephei::Core::Generic::ICoCell<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^>^>^ Cephei::QL::Models::Marketmodels::Pathwisegreeks::CVegaBumpCluster_Factory::CreateCellVector (PLATFORM::Collections::Generic::IEnumerable<Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^>^ source)
 {
	 return CellFactory::Instance->Create<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^>^>^> (REFNEW CoCellVector<Cephei::QL::Models::Marketmodels::Pathwisegreeks::IVegaBumpCluster^> (source, REFNEW CVegaBumpClusterVector ()));
 }

